<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta charset="UTF-8">
    <title>修改密码</title>
    <link rel="stylesheet" type="text/css" href="css/frameHtml.css">
    
		<link rel="stylesheet" href="plugins/layui/css/layui.css" media="all" />
		<link rel="stylesheet" href="LayerCss/global.css" media="all">
		<link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
		<link rel="stylesheet" href="LayerCss/table.css" />
    
    <script type="text/javascript" src="js/jquery-3.1.0.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui.min.js"></script>
    <script type="text/javascript" src="js/tch_formRequired.js"></script><!--表单验证JS-->
    <script type="text/javascript" src="js/layer/layer.js"></script><!--表单验证JS-->
   
    <script type="text/javascript">
        $(document).ready(function () {
         	$('#submit').click(function () {
                $("form :input").trigger('blur');
                var numError = $('form .error,form .warning').length;
                if (numError>0) {
                	layer.msg('信息填写错误', {time:1000,icon: 2});
                }else{
                	var passwordOld = $("#passwordOld").val();
                	var password = $("#password").val();
	    			$.ajax({
						url:"../StuPasswordModify.do",
						type:"post",
						dataType:"json",
	        			data:"passwordOld="+passwordOld+"&password="+password,
	        			success:function(data){
	        				if(data=="true"){
	        				    layer.alert('修改成功',function(index){
	        				          layer.close(index); //如果设定了yes回调，需进行手工关闭
	        							location.href = "stu_StudentInfo.html";
	        				        });        
	        				              
	        				}else{
	        					alert("密码修改失败！");
	        				}
	        			}});
                }
            });
            $("#back").click(function () {
        		location.href = "stu_StudentInfo.html";
        	});
        })

    </script>
    
    <style type="text/css">
    	#back{
			color: #fff;
			cursor: pointer;
			margin:20px;
		}
    </style>
</head>
<body>
<a href="javascript:;"class="layui-btn" id="back">
	<i class="layui-icon" style="color: #fff;">&#xe603;</i> 返回
</a>

<form>
<table class="addClass passwordModify" style="width: 400px;" border="0" cellspacing="0" cellpadding="0">
    <tr><th>原始密码</th><td><input type="password" name="passwordOld" id="passwordOld" class="passwordOld" placeholder="请输入原始密码" promptNull="原始密码不能为空"
                                promptError="请输入正确原始密码"></td></tr>
    <tr><th>新密码</th><td><input type="password" name="password" class="password" id="password" placeholder="请输入密码" promptNull="密码不能为空"
                               promptError="请输入正确格式"></td></tr>
    <tr><th>确认新密码</th><td><input type="password" name="passwordConfirm" class="passwordConfirm" placeholder="请输入确认密码" promptNull="请输入确认密码"
                                 promptError="两次密码输入不一致"></td></tr>
</table>
</form>
<div class="operationGather">

<button class="layui-btn" id="submit">
	修改
</button>
</div>
</body>
</html>

